<template>
	<view class="detail">
		<view class="acea-row row-middle row-center bold color333 mt40 fs-40">设备绑定成功</view>
		<view class="acea-row row-middle row-center mt40">
			<image class="success-icon" src="https://yijiaan.oss-cn-hangzhou.aliyuncs.com/pic/success-icon.png" mode="aspectFit"></image>
		</view>
		<view class="bangding-nav">
			<view class="fs-30 color333 bold">设备信息</view>
			<view class="acea-row row-between-wrapper bor-bot py30 fs-28">
				<view class="color666">备注名称：</view>
				<view class="color333" style="width: 450rpx;text-align: right;">{{ info.mark }}</view>
			</view>
			<view class="acea-row row-between-wrapper bor-bot py30 fs-28">
				<view class="color666">设备：</view>
				<view class="color333" style="width: 400rpx;text-align: right;">{{ info.deviceName }}</view>
			</view>
			<view class="acea-row row-between-wrapper py30 fs-28">
				<view class="color666">设备序列号：</view>
				<view class="color333" style="width: 400rpx;text-align: right;">{{ info.imei }}</view>
			</view> 
		</view>
		<view class="jiebang" @tap="jiebang">解绑设备</view>
	</view>
</template>

<script>
	
	import{
		deviceDetails,
		devicedel
	} from '@/api/admin.js'
	export default {
		data() {
			return {
				imei:0,
				info:[],
				
			};
		},
		onLoad(option) {
			this.imei = option.imei;
			this.getdetail();
		},
		methods:{
			jiebang(){
				let that = this;
				uni.showModal({
					title: '提示',
					content: '是否解绑此设备？',
					success: function (res) {
						if (res.confirm) {
							devicedel({ imei: that.imei }).then(res=>{
								that.$util.Tips({ title: res.msg },()=>{
									uni.navigateBack();
								})
							}).catch(err=>{
								that.$util.Tips({ title : err })
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});

			},
			getdetail(){
				let that = this;
				deviceDetails({ imei: that.imei }).then(res=>{
					that.info = res.data.data;
				}).catch(err=>{
					that.$util.Tips({ title : err })
				})
			}
		}
	}
</script>

<style lang="scss">
	.detail{
		padding: 30rpx;
		
		.success-icon{
			width: 192rpx;
			height: 192rpx;
		}
		
		.bangding-nav{
			width: 690rpx;
			border-radius: 40rpx;
			background-color: #ffffff;
			margin: 40rpx 0;
			padding: 40rpx;
		}
		
		.jiebang{
			width: 690rpx;
			height: 104rpx;
			border-radius: 60rpx;
			background: rgba(253, 130, 62, 0.2);
			color: #FD823E;
			text-align: center;
			line-height: 104rpx;
			font-size: 32rpx;
		}
	}
</style>
